package com.zcoj.service;

import com.zcoj.core.model.PageData;
import com.zcoj.core.model.PageWrap;
import com.zcoj.pojo.Dto.Judge;
import com.zcoj.pojo.Dto.JudgeResult;
import com.zcoj.pojo.Vo.JudgeCaseVo;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

/**
 * Service定义
 * @author 剩xia的盛夏
 * @date 2023/02/24 16:16
 */
@CacheConfig(cacheNames = "JudgerService")
public interface JudgerService {

    /**
     * 创建
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */
    @CacheEvict(value = "JudgerService",allEntries = true)
    Integer create(Judge judge);

    /**
     * 主键删除
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */

    @CacheEvict(value = "JudgerService",allEntries = true)
    void deleteById(Integer id);

    /**
     * 批量主键删除
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */

    @CacheEvict(value = "JudgerService",allEntries = true)
    void deleteByIdInBatch(List<Integer> ids);

    /**
     * 主键更新
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */

    @CacheEvict(value = "JudgerService",allEntries = true)
    void updateById(Judge judge);

    /**
     * 批量主键更新
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */

    @CacheEvict(value = "JudgerService",allEntries = true)
    void updateByIdInBatch(List<Judge> judges);

    /**
     * 主键查询
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */
    @Cacheable(key = "#p0.toString()+'findById'")
    Judge findById(Integer id);

    /**
     * 条件查询单条记录
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */
    @Cacheable(key = "#p0.toString()+'findOne'")
    Judge findOne(Judge judge);

    /**
     * 条件查询
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */
    @Cacheable(key = "#p0.toString()+'findList'")
    List<Judge> findList(Judge judge);
  
    /**
     * 分页查询
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */
    @Cacheable(key = "#p0.toString()+'findPage'")
    PageData<Judge> findPage(PageWrap<Judge> pageWrap);

    @Cacheable(key = "#p0.toString()+'findPagevo'")
    PageData<Judge> findPageVo(PageWrap<Judge> pageWrap);

    @Cacheable(key = "#p0.toString()+'getJudgeDetail'")
    JudgeCaseVo getJudgeDetail(Integer sid);

    @Cacheable(key = "'findAllJudgeResult'")
    List<JudgeResult> findAllJudgeResult();
    /**
     * 条件统计
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */
    long count(Judge judge);
}
